package com.hivekion.customer.controller;

import com.hivekion.common.annotation.AutoLog;
import com.hivekion.common.entity.PagedResultVo;
import com.hivekion.common.enums.OperationTypeEnum;
import com.hivekion.customer.domain.vo.CustomerModelVo;
import com.hivekion.customer.domain.vo.CustomerSearchInputVo;
import com.hivekion.customer.domain.vo.CustomerViewVo;
import com.hivekion.customer.service.ICustomerService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/ele/customer")
public class CustomerController {

    @Resource
    private ICustomerService customerService;


    @PostMapping("/getList")
    @AutoLog(value = "获取用户列表", operationType = OperationTypeEnum.SELECT, module = "用户管理/获取用户列表")
    public PagedResultVo<CustomerViewVo> getList(@RequestBody CustomerSearchInputVo vo) {
        return customerService.getList(vo);
    }

    @PutMapping("/updateStatus")
    @AutoLog(value = "修改用户状态", operationType = OperationTypeEnum.SELECT, module = "用户管理/修改用户状态")
    public boolean updateStatus(String key, Integer status) {
        return customerService.updateStatus(key, status);
    }

    @GetMapping("/getInfo")
    @AutoLog(value = "获取用户详情", operationType = OperationTypeEnum.SELECT, module = "用户管理/获取用户详情")
    public CustomerModelVo getInfo(String key) {
        return customerService.getInfo(key);
    }
}
